/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.aal.entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author quy
 */
@Entity
@Table(name = "OrderProduct")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "OrderProduct.findMaxOrderID", query = "SELECT MAX(o.orderID) FROM OrderProduct o"),
    @NamedQuery(name = "OrderProduct.findAll", query = "SELECT o FROM OrderProduct o"),
    @NamedQuery(name = "OrderProduct.findByOrderID", query = "SELECT o FROM OrderProduct o WHERE o.orderID = :orderID"),
    @NamedQuery(name = "OrderProduct.findByOrderDate", query = "SELECT o FROM OrderProduct o WHERE o.orderDate = :orderDate"),
    @NamedQuery(name = "OrderProduct.findByTotalNetPrice", query = "SELECT o FROM OrderProduct o WHERE o.totalNetPrice = :totalNetPrice"),
    @NamedQuery(name = "OrderProduct.findByDiscountValue", query = "SELECT o FROM OrderProduct o WHERE o.discountValue = :discountValue"),
    @NamedQuery(name = "OrderProduct.findByShippingCost", query = "SELECT o FROM OrderProduct o WHERE o.shippingCost = :shippingCost"),
    @NamedQuery(name = "OrderProduct.findByTaxCost", query = "SELECT o FROM OrderProduct o WHERE o.taxCost = :taxCost"),
    @NamedQuery(name = "OrderProduct.findByTotalPrice", query = "SELECT o FROM OrderProduct o WHERE o.totalPrice = :totalPrice"),
    @NamedQuery(name = "OrderProduct.findByStatus", query = "SELECT o FROM OrderProduct o WHERE o.status = :status"),
    @NamedQuery(name = "OrderProduct.findByShippingAddress", query = "SELECT o FROM OrderProduct o WHERE o.shippingAddress = :shippingAddress"),
    @NamedQuery(name = "OrderProduct.findByReceivername", query = "SELECT o FROM OrderProduct o WHERE o.receivername = :receivername"),
    @NamedQuery(name = "OrderProduct.findByReceiverPhone", query = "SELECT o FROM OrderProduct o WHERE o.receiverPhone = :receiverPhone"),
    @NamedQuery(name = "OrderProduct.findByCustomerName", query = "SELECT o FROM OrderProduct o WHERE o.customerName = :customerName"),
    @NamedQuery(name = "OrderProduct.findByBillingAddress", query = "SELECT o FROM OrderProduct o WHERE o.billingAddress = :billingAddress")})
public class OrderProduct implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @GeneratedValue(strategy= GenerationType.IDENTITY)
    @Column(name = "OrderID")
    private Long orderID;
    @Column(name = "OrderDate")
    @Temporal(TemporalType.TIMESTAMP)
    private Date orderDate;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "TotalNetPrice")
    private Double totalNetPrice;
    @Column(name = "DiscountValue")
    private Double discountValue;
    @Column(name = "ShippingCost")
    private Double shippingCost;
    @Column(name = "TaxCost")
    private Double taxCost;
    @Column(name = "TotalPrice")
    private Double totalPrice;
    @Column(name = "Status")
    private Integer status;
    @Size(max = 500)
    @Column(name = "ShippingAddress")
    private String shippingAddress;
    @Size(max = 100)
    @Column(name = "Receivername")
    private String receivername;
    @Size(max = 100)
    @Column(name = "ReceiverPhone")
    private String receiverPhone;
    @Size(max = 100)
    @Column(name = "CustomerName")
    private String customerName;
    @Size(max = 500)
    @Column(name = "BillingAddress")
    private String billingAddress;
    @JoinColumn(name = "Username", referencedColumnName = "Username")
    @ManyToOne
    private Customer username;

    public OrderProduct() {
    }

    public OrderProduct(Long orderID) {
        this.orderID = orderID;
    }

    public Long getOrderID() {
        return orderID;
    }

    public void setOrderID(Long orderID) {
        this.orderID = orderID;
    }

    public Date getOrderDate() {
        return orderDate;
    }

    public void setOrderDate(Date orderDate) {
        this.orderDate = orderDate;
    }

    public Double getTotalNetPrice() {
        return totalNetPrice;
    }

    public void setTotalNetPrice(Double totalNetPrice) {
        this.totalNetPrice = totalNetPrice;
    }

    public Double getDiscountValue() {
        return discountValue;
    }

    public void setDiscountValue(Double discountValue) {
        this.discountValue = discountValue;
    }

    public Double getShippingCost() {
        return shippingCost;
    }

    public void setShippingCost(Double shippingCost) {
        this.shippingCost = shippingCost;
    }

    public Double getTaxCost() {
        return taxCost;
    }

    public void setTaxCost(Double taxCost) {
        this.taxCost = taxCost;
    }

    public Double getTotalPrice() {
        return totalPrice;
    }

    public void setTotalPrice(Double totalPrice) {
        this.totalPrice = totalPrice;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getShippingAddress() {
        return shippingAddress;
    }

    public void setShippingAddress(String shippingAddress) {
        this.shippingAddress = shippingAddress;
    }

    public String getReceivername() {
        return receivername;
    }

    public void setReceivername(String receivername) {
        this.receivername = receivername;
    }

    public String getReceiverPhone() {
        return receiverPhone;
    }

    public void setReceiverPhone(String receiverPhone) {
        this.receiverPhone = receiverPhone;
    }

    public String getCustomerName() {
        return customerName;
    }

    public void setCustomerName(String customerName) {
        this.customerName = customerName;
    }

    public String getBillingAddress() {
        return billingAddress;
    }

    public void setBillingAddress(String billingAddress) {
        this.billingAddress = billingAddress;
    }

    public Customer getUsername() {
        return username;
    }

    public void setUsername(Customer username) {
        this.username = username;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (orderID != null ? orderID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof OrderProduct)) {
            return false;
        }
        OrderProduct other = (OrderProduct) object;
        if ((this.orderID == null && other.orderID != null) || (this.orderID != null && !this.orderID.equals(other.orderID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.aal.entity.OrderProduct[ orderID=" + orderID + " ]";
    }
    
}
